﻿using System;
using System.Globalization;
using System.Windows.Data;
using SKYPE4COMLib;

namespace Wra4Skype
{
    /// <summary>   
    /// A type converter to convert Skype status text to background color
    /// </summary>   
    public class SkypeStatusConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return "Black";
            }

            switch ((TOnlineStatus)value)
            {
                case TOnlineStatus.olsOnline: return "Black";
                case TOnlineStatus.olsOffline: return "DarkGray";
                case TOnlineStatus.olsNotAvailable: return "Orange";
                case TOnlineStatus.olsAway: return "Orange";
                default: return "Green";    // this would be very strange. it is just to handle future cases of new user status options in Skype
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }
    }
}